﻿namespace AutoRevit.Ribbon.Ribbon.Mapper;

/// <summary>
/// 板块映射器
/// </summary>
public class PanelMapper : ControlItemMapperBase
{
    /// <summary>
    /// 
    /// </summary>
    /// <param name="name"></param>
    public PanelMapper(string name)
    {
        Name = name;
    }

    /// <summary>
    /// 实际已生成的控件
    /// </summary>
    public Autodesk.Revit.UI.RibbonPanel? Control { get; internal set; }

    /// <summary>
    /// 获取当前PanelMapper下的ControlItemMapper
    /// </summary>
    /// <param name="itemName"></param>
    /// <returns></returns>
    public ControlItemMapper? this[string itemName]
    {
        get
        {
            return Items.FirstOrDefault(t => t.Name == itemName);
        }
    }

    /// <summary>
    /// 控件映射器集合
    /// </summary>
    public List<ControlItemMapper> Items { get; set; } = [];
}
